package com.liwei.appio;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class MyApp2 {
    public static void main(String[] args) {
        String temp="bbbbbbb";
        String path="d:\\bb.txt";
        try {
            //写入文件有是否追加的参数(true,false)
            FileOutputStream fileOutputStream = new FileOutputStream(path,false);
            byte[] bytes=temp.getBytes();
            fileOutputStream.write(bytes,0,bytes.length);
            //把缓存的数据写入到文件【FileOutputStream中的flush并没有任何实现】
            fileOutputStream.flush();
            fileOutputStream.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
